home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / lib / geometry / hpointn / hpointn.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-03  |  1.0 KB  |  41 lines

  1. /* Copyright (c) 1993 The Geometry Center; University of Minnesota
  2.    1300 South Second Street;  Minneapolis, MN  55454, USA;
  3.    
  4. This file is part of geomview/OOGL. geomview/OOGL is free software;
  5. you can redistribute it and/or modify it only under the terms given in
  6. the file COPYING, which you should have received along with this file.
  7. This and other related software may be obtained via anonymous ftp from
  8. geom.umn.edu; email: software@geom.umn.edu. */
  9.  
  10. /* Authors: Olaf Holt */
  11.  
  12.  
  13. #include <ooglutil.h>
  14. #include "hpointn.h"
  15. #include <math.h>
  16.  
  17. HPointN *
  18. HPtNCreate(int dim, const HPtNCoord *vec)
  19. {
  20.     HPointN *pt = OOGLNewE(HPointN, "new HPointN");
  21. /*    pt->space = 0;              */
  22.     if(dim <= 0) dim = 1;
  23.     pt->dim = dim;
  24.     pt->v = OOGLNewNE(HPtNCoord, dim, "new HPointN data");
  25.     if(vec == NULL) {
  26.         bzero(pt->v, dim*sizeof(HPtNCoord));
  27.         pt->v[dim-1] = 1;
  28.     } else
  29.         memcpy(pt->v, vec, dim*sizeof(HPtNCoord));
  30.     return pt;
  31. }
  32.  
  33. void
  34. HPtNDelete(HPointN *pt)
  35. {
  36.     if(pt) {
  37.     if(pt->v) OOGLFree(pt->v);
  38.     OOGLFree(pt);
  39.     }
  40. }
  41.